package com.scheduled.pojo;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.scheduled.config.LocalDateTimeDeserializer;
import com.scheduled.config.LocalDateTimeSerializer;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.Future;
import javax.validation.constraints.NotBlank;
import java.time.LocalDateTime;

/**
 * @author : z_sz
 * @date : 2020-08-10 10:26
 **/
@Data
@Accessors(chain = true)
public class ScheduledRequest {

    /**
     * 任务id,任务唯一标识
     */
    private String id;

    /**
     * 执行标题
     */
    @NotBlank(message = "执行标题不能为空")
    private String executeTitle;

    /**
     * 执行时间
     */
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @Future(message = "定时执行的执行时间要是将来的时间")
    private LocalDateTime executeTime;

    /**
     * 任务执行状态：0为未执行，1为已执行
     */
    private Integer taskStatus;

    /**
     * 本机ip
     */
    private String taskIp;

}
